﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Plugin.TradeSharp
{
    public partial class UCTime : UserControl
    {
        public UCTime()
        {
            InitializeComponent();
            this.numericUpDownHour.Maximum = 24;
            this.numericUpDownMinute.Maximum = 60;
            this.numericUpDownSecond.Maximum = 60;

        }
        public int Time
        {
            get
            {
                var ret = this.numericUpDownHour.Value * 10000 + this.numericUpDownMinute.Value * 100 + this.numericUpDownSecond.Value;
                return (int)ret;
            }
            set
            {
                if (value < 0 || value > 246060)
                {
                    throw new ArgumentOutOfRangeException();
                }
                this.numericUpDownHour.Value = value / 10000;
                this.numericUpDownMinute.Value = (value / 100) % 100;
                this.numericUpDownSecond.Value = value % 100;
            }
        }
    }
}
